﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net.Core;
using log4net.Util;
using agsXMPP;
using agsXMPP.protocol.client;
using agsXMPP.protocol.x.muc;
using System.Text.RegularExpressions;
using agsXMPP.protocol.extensions.html;
using agsXMPP.Xml.Dom;
namespace log4net.Extensions.Appender.XMPP
{
    public class XMPPChatroomAppender:XMPPAppender
    {
        public string ChatRoom { get; set; }

        protected override void OnConnected(XMPPAppenderConnection conn)
        {
            string roomName = string.Format("{0}@conference.{1}", this.ChatRoom, this.Server);
            Jid roomJid=new Jid(roomName);
            conn.MucManager.JoinRoom(roomJid, Environment.MachineName);
        }

 

        protected override void Append(LoggingEvent loggingEvent)
        {
            Message message = GetMessage(loggingEvent);
            string roomName = string.Format("{0}@conference.{1}", this.ChatRoom, this.Server);
            message.To = new Jid(roomName);
            QueueMessage(message);
        }


    }
}
